package com.qf.service.impl;

import com.qf.mapper.ShopMapper;
import com.qf.pojo.Shop;
import com.qf.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ShopServiceImpl implements ShopService {
    @Autowired
    private ShopMapper shopMapper;
    @Override
    public List<Shop> findAll() {
        List<Shop> list = shopMapper.findAllShop();
        if (list!=null){
            return list;
        }
        return null;
    }
//查询单个商品
    @Override
    public Shop findShopById(Integer shopId) {
        Shop shop = shopMapper.selectShopById(shopId);
        System.out.println(shop);
        if (shop!=null){
            return shop;
        }
        return null;
    }

    @Override
    public void updateShop(Shop shop) {
        shopMapper.updateShopById(shop);
    }

    @Override
    public void deleteShop(Shop shop) {
        shopMapper.deleteShopById(shop);
    }

    @Override
    public void add(Shop shop) {
            shopMapper.addShop(shop);
    }
}
